<template>
	<view class="wrap">
	
		
		<view class="mima-t">
			对方姓名
		</view>
		<view class="pwd-wrap">
			<input  v-model="other_name" type="text" placeholder="请输入对方姓名" />
		</view>
		<view class="mima-t">
			对方手机号
		</view>
		<view class="pwd-wrap">
			<input v-model="other_phone" type="text" placeholder="请输入对方手机号" />
		</view>
		<view class="mima-t">
			转账类型
		</view>
		<view class="pwd-wrap">
			
			<radio-group @change="radioChange">
				<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items" :key="item.value">
					
						<radio :value="item.value" :checked="item.value === current" />
					
					<text class="item-name">{{item.name}}</text>
				</label>
			</radio-group>
		</view>
		<view class="pwd-wrap">
			
			<radio-group @change="radioChange">
				<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items2" :key="item.value">
					
						<radio :value="item.value" :checked="item.value === current" />
					
					<text class="item-name">{{item.name}}</text>
				</label>
			</radio-group>
		</view>
		<view class="pwd-wrap">
			<input v-model="number" type="text" :placeholder="holder" />
		</view>
		<view class="mima-t">
			交易密码
		</view>
		<view class="pwd-wrap">
			<input v-model="jy_pwd" type="password" placeholder="请输入交易密码" />
		</view>
		<view class="duihuan-wrap" @click="subData">
			确认提交
		</view>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				holder:'请输入央厨通证数量',
				other_name:'',
				other_phone:'',
				number:'',
				jy_pwd:'',
				 items: [
					//  {
					// 	value: '1',
					// 	name: 'ADC',
					// 	checked: 'true'
					// },
					// {
					// 	value: '2',
					// 	name: 'USD'
					// },
					// {
					// 	value: '3',
					// 	name: 'ADM'
					// },{
					// 	value: '4',
					// 	name: 'HY'
					// }
					
				],
				items2: [
					{
						value: '5',
						name: '央厨通证'
					}
				],
				current: '5'
			}
		},
		onLoad() {

		},
		methods: {
			subData(){
				if(this.other_name==''){
					uni.showToast({
					    title: '请输入对方姓名',
					    duration:4000,
						icon:'none'
					});
					return
				}
				if(this.other_phone==''){
					uni.showToast({
					    title: '请输入对方手机号',
					    duration:4000,
						icon:'none'
					});
					return
				}
				if(this.number==''){
					uni.showToast({
					    title: '请输入划转数量',
					    duration:4000,
						icon:'none'
					});
					return
				}
				if(this.jy_pwd==''){
					uni.showToast({
					    title: '请输入交易密码',
					    duration:4000,
						icon:'none'
					});
					return
				}
				let that=this
				
				uni.showModal({
				    title: '确定提交',
				    content: '',
				    success: function (res) {
				        if (res.confirm) {
				           that.apipost('/api/user/transfer',{
				           	other_name:that.other_name,
				           	other_phone:that.other_phone,
				           	type:that.current,
				           	number:that.number,
				           	jy_pwd:that.jy_pwd
				           },true).then(res => {
				           	if(res.Code==10200){
				           		
				           		let data=res.Data
				           		uni.showToast({
				           		    title: res.Message,
				           		   duration:4000,
				           			icon:'none'
				           		});
				           	}
				           	
				           }).catch(err=>{
				           	console.log(err)
				           });
				           
				        } else if (res.cancel) {
				            
				        }
				    }
				});
				
			},
			radioChange: function(evt) {
				
			   switch(Number(evt.detail.value)){
				   case 1:
				   this.holder='请输入'+'ADC数量'
				   break;
				   case 2:
				   this.holder='请输入'+'USD数量'
				   break;
				   case 3:
				   this.holder='请输入'+'ADM数量'
				   break;
				   case 4:
				   this.holder='请输入'+'HY数量'
				   break;
				   case 5:
				   this.holder='请输入'+'央厨通证数量'
				   break;
			   }
				this.current = evt.detail.value;
				
			},
			
		}
	}
</script>

<style>
	.item-name{
		padding:0 6rpx;
		margin-right:8rpx;
	}
	.tip-bottom{
		color:#fcb460;
		
	}
	.tip-top{
		color:#fcb460;
		margin-top:48rpx;
		margin-bottom:18rpx;
	}
	.pwd-wrap{
		padding-top:32rpx;
		padding-bottom:16rpx;
		border-bottom:1rpx solid #f5f5f5;
	}
	.duihuan-wrap{
		width:668rpx;
		height:86rpx;
		background:#007aff;
		color:#fff;
		display:flex;
		align-items: center;
		justify-content: center;
		border-radius:12rpx;
		margin-top:102rpx;
		
	}
	.num-wrap {
		flex:1;
	}
	.num-wrap input{
		width:100%;
	}
	.mima-t{
		padding-top:28rpx;
	}
	.dingdanjine-num{
		padding-bottom:30rpx;
		border-bottom:1rpx solid #f5f5f5;
	}
	.dingdanjine{
		padding:28rpx 0;
	}
	.yue{
		height:98rpx;
		display:flex;
		align-items: center;
	}
	.yue .label{
		margin-right:38rpx;
	}
	.hy-num .label{
		margin-right:68rpx;
	}
	.hy-num{
		height:66rpx;
		display:flex;
		align-items: center;
		border-bottom:1rpx solid #f5f5f5;
	}
	.wrap{
		padding:0 50rpx 0 52rpx;
	}
</style>
